package com.ruoyi.web.controller.solidDispose;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.solidDispose.domain.WxfwczInfo;
import com.ruoyi.solidDispose.service.IWxfwczInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 危险废物处置信息Controller
 * 
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/solidDispose/wxfwczInfo")
public class WxfwczInfoController extends BaseController
{
    @Autowired
    private IWxfwczInfoService wxfwczInfoService;

    /**
     * 查询危险废物处置信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwczInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(WxfwczInfo wxfwczInfo)
    {
        startPage();
        List<WxfwczInfo> list = wxfwczInfoService.selectWxfwczInfoList(wxfwczInfo);
        return getDataTable(list);
    }

    /**
     * 导出危险废物处置信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwczInfo:export')")
    @Log(title = "危险废物处置信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WxfwczInfo wxfwczInfo)
    {
        List<WxfwczInfo> list = wxfwczInfoService.selectWxfwczInfoList(wxfwczInfo);
        ExcelUtil<WxfwczInfo> util = new ExcelUtil<WxfwczInfo>(WxfwczInfo.class);
        return util.exportExcel(list, "危险废物处置信息数据");
    }

    /**
     * 获取危险废物处置信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwczInfo:query')")
    @GetMapping(value = "/{wxfwczId}")
    public AjaxResult getInfo(@PathVariable("wxfwczId") Long wxfwczId)
    {
        return AjaxResult.success(wxfwczInfoService.selectWxfwczInfoById(wxfwczId));
    }

    /**
     * 新增危险废物处置信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwczInfo:add')")
    @Log(title = "危险废物处置信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WxfwczInfo wxfwczInfo)
    {
        return toAjax(wxfwczInfoService.insertWxfwczInfo(wxfwczInfo));
    }

    /**
     * 修改危险废物处置信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwczInfo:edit')")
    @Log(title = "危险废物处置信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WxfwczInfo wxfwczInfo)
    {
        return toAjax(wxfwczInfoService.updateWxfwczInfo(wxfwczInfo));
    }

    /**
     * 删除危险废物处置信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwczInfo:remove')")
    @Log(title = "危险废物处置信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{wxfwczIds}")
    public AjaxResult remove(@PathVariable Long[] wxfwczIds)
    {
        return toAjax(wxfwczInfoService.deleteWxfwczInfoByIds(wxfwczIds));
    }
}
